﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TestSchool
{
    [TestClass()]

    public class CourseTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }


        [TestMethod()]
        public void AddStudentTestEmpty()
        {
            Course target = new Course(); 
            Student student = new Student("Hristo", 64354); 
            target.AddStudent(student);
        }

        [TestMethod()]
        public void AddStudentTestTwice()
        {
            Course target = new Course();
            Student student = new Student("Hristo", 64354);
            target.AddStudent(student);
            target.AddStudent(student);
        }

        [ExpectedException(typeof(OverflowException))]
        [TestMethod()]
        public void AddStudentTestOverflow()
        {
            Course target = new Course();

            for (int i = 0; i <= 31; i++)
            {
                target.AddStudent(new Student(i.ToString(),10000+i));
            }
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException))]
        public void DismissStudentTestEmpty()
        {
            Course target = new Course();
            Student student = new Student("Hristo", 64354);
            target.DismissStudent(student);
        }

        [TestMethod()]
        public void DismissStudentTestFull()
        {
            Course target = new Course();
            Student student = new Student("Hristo", 64354);
            target.AddStudent(student);
            target.DismissStudent(student);
        }
    }
}
